﻿using System;
using System.Collections.Generic;
using Soft000.Model;
using Soft000.IDAL;
using Soft000.Data;
using System.Text;
using System.Data;
using System.Data.OleDb;
using Soft000.Model;

namespace Soft000.AccessProvider
{
    public class User:Base<UserInfo>,IUser
    {
        public User()
        {
            TableName = "users";
            KeyField = "u_id";
        }

        public UserInfo GetInfoByUserName(string strUserName)
        {
            UserInfo info = null;
            string strSql = "select * from " + TableName + "username=@userName";
            OleDbParameter[] parm ={
                                       new OleDbParameter("@userName",strUserName)
                                 };
            using (OleDbDataReader reader =(OleDbDataReader) DbHelper.ExecuteReader(CommandType.Text, strSql, parm))
            {
                try
                {
                    info = GetInfoByReader(reader);
                }
                finally
                {
                    reader.Close();
                    reader.Dispose();
                }
            }
            return info;
        }
    }
}
